package com.boatAnchorAssistant.service.repository.impl;

import com.boatAnchorAssistant.pojo.entity.ExpandField;
import com.boatAnchorAssistant.service.mapper.ExpandFieldMapper;
import com.boatAnchorAssistant.service.repository.in.ExpandFieldRepository;
import nirvana.core.repository.Repository;
import org.springframework.stereotype.Service;
import com.boatAnchorAssistant.pojo.dto.expandField.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.util.StringUtils;

/**
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@Service
public class ExpandFieldRepositoryImpl extends Repository<ExpandFieldMapper, ExpandField> implements ExpandFieldRepository {

    private final ExpandFieldMapper mapper;

    public ExpandFieldRepositoryImpl(ExpandFieldMapper mapper) {
        this.mapper = mapper;
    }

    /**
     * 搜索拓展字段
     *
     * @param dto
     * @return
     */
    @Override
    public Page<ExpandField> selectExpandField(SelectExpandFieldDto dto) {

        return mapper.selectExpandField(dto);
    }

    /**
     * 清空
     *
     * @param model
     */
    @Override
    public void clean(String model) {
        if (!StringUtils.hasText(model)) {
            return;
        }

        ExpandField t = new ExpandField();
        t.setModel(model);
        mapper.delete(getWrapper(t));
    }

}